package com.yc.cloud.openai.portal.controller;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.yc.cloud.common.basic.api.ResponseResult;
import com.yc.cloud.common.basic.dto.BaseQueryParam;
import com.yc.cloud.common.orm.CommonPage;
import com.yc.cloud.openai.portal.dto.request.ModelRecordListParam;
import com.yc.cloud.openai.portal.service.ModelRecordService;
import com.yc.cloud.openai.vo.ModelRecordVo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import jakarta.annotation.Resource;
import lombok.val;

/**
 * 3D模型记录
 *
 * @author Yancy
 * @date 2025-02-16
 */
@RestController
@RequestMapping("/model/record")
@Api(value = "3D模型记录", tags = "3D模型记录")
public class ModelRecordController {

        @Resource
        private ModelRecordService modelRecordService;

        @GetMapping
        @ApiOperation(value = "3D模型记录列表", notes = "支持分页查询,字段模糊匹配,排序等")
        public ResponseResult<CommonPage<ModelRecordVo>> list(ModelRecordListParam param,
                        @Validated BaseQueryParam queryParam) {
                val result = modelRecordService.list(param, queryParam);
                return ResponseResult.success(CommonPage.restPage(result));
        }

        @GetMapping("{id}")
        @ApiOperation(value = "3D模型记录详情", notes = "根据ID查询")
        public ResponseResult<ModelRecordVo> get(@PathVariable @ApiParam(value = "ID", required = true) Long id) {
                val result = modelRecordService.get(id);
                return ResponseResult.success(result);
        }

        // @PostMapping
        // @ApiOperation(value = "添加3D模型记录", notes = "添加")
        // public ResponseResult<ModelRecord> create(@Validated @RequestBody ModelRecord
        // param) {
        // val result = modelRecordService.create(param);
        // return result != null ? ResponseResult.success(result) :
        // ResponseResult.failed();
        // }
        //
        // @ApiOperation(value = "删除3D模型记录", notes = "通过ID删除")
        // @DeleteMapping(value = "{id}")
        // public ResponseResult<Boolean> delete(@PathVariable @ApiParam(value = "ID",
        // required = true) Long id) {
        // val result = modelRecordService.delete(id);
        // return result ? ResponseResult.success(true) : ResponseResult.failed();
        // }
        //
        // @ApiOperation(value = "修改3D模型记录", notes = "通过ID修改")
        // @PutMapping(value = "{id}")
        // public ResponseResult<ModelRecord> update(@PathVariable @ApiParam(value =
        // "ID", required = true) Long id,
        // @Validated @RequestBody ModelRecord param) {
        // val result = modelRecordService.update(id, param);
        // return result != null ? ResponseResult.success(result) :
        // ResponseResult.failed();
        // }
}
